﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace Sino.CapacityCloud.Web
{
    public class AquireStorageSharedSignitureResponse
    {
        public string ContainerName;
        public string Expire;
        public string StorageSharedSigniture;
    }

    public class StorageController : Controller
    {
        //登陆
        [HttpGet("Storage/AquireStorageSharedSigniture/{containerName}")]
        public IActionResult AquireStorageSharedSigniture(string containerName , TimeSpan? expireTime = null)
        {
            if (containerName == null)
            {
                return BadRequest();
            }
            var response = new AquireStorageSharedSignitureResponse()
            {
                ContainerName = "avatar-container",
                Expire = "1.00:00:00",
                StorageSharedSigniture = "https://sinostoragedev.blob.core.chinacloudapi.cn/avatar-container?sv=2015-07-08&sr=c&sig=%2FqpRFB7DpXrkplozduZJvOPK9U%2BfVU7FeU4I%2BknHMLY%3D&st=2016-10-17T05%3A40%3A12Z&se=2016-10-18T05%3A45%3A12Z&sp=racwl"

            };
            return Json(response, new Newtonsoft.Json.JsonSerializerSettings() { ContractResolver = new DefaultContractResolver() });
        }

        
    }
}
